<%@include file="startUpIncludes.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Edit Profile</title>
    <script type="text/javascript" src="../js/modalwin.js"></script>
    <script type="text/javascript" src="../js/validation.js"></script>
    <script type="text/javascript" src="../js/validationLeadForm.js"></script>
    </head>
    <body>
    <jsp:include page="header.jsp" >
		<jsp:param value="true" name="loggedIn"/>
	</jsp:include>
    <div class="modal-win-bg">
        <div class="modal-win-box">
            <div class="modal-win-hd">
                <span class="modal-win-title"></span>
                <span class="modal-win-close">x</span>
            </div>
            <div class="modal-win-content"></div>
            <a class="form-btn modal-win-ok">OK</a>
        </div>
    </div>
    <div class="wrap">
	<div class="fitBG">
        <div class="main">
		<%@include file="basicLeftMenu.jsp" %>
            <div class="content">
				<jsp:include page="tabs.jsp" >
					<jsp:param value="profile" name="currentPage"/>
				</jsp:include>
                <div class="tab-content">
                <h3>Edit Personal Information</h3>
                <form:form class="new-lead-form" method="post" action="/sales/s/edit-profile" enctype="multipart/form-data" commandName="profileForm">
                <form:errors path="*" cssClass="error-block" element="div"/>
                <div class="btns">
                <input type="submit" value="Save" class="form-btn"/><a href="/sales/s/profile" class="form-btn">Cancel</a>
                </div>
                <div class="form-row">
                    <h4>Personal Information</h4>
					<span class="required-error">These fields are requied, please make sure to fill them all.</span>
					<div class="input-col">
						<c:choose>
						          <c:when test="${userDetails.photo==null}">
						             <a href="/sales/s/profile"><img src="../images/noprofile.jpg" class="edit-profile-image"/></a>
						          </c:when>
						          <c:otherwise>
						          <a href="/sales/s/profile"><img src="${post.poster.photo.encode}" class="edit-profile-image"/></a>
						          </c:otherwise>
						        </c:choose>
						<input type="file" class="TB file-input" name="fileInput"/>
					</div>
                    <div class="info"><label>Email: </label><span>${userDetails.email}</span><label>Company: </label><span>Asset</span></div>
                    <div class="input-col">
                        <label>First Name: </label>
                        <form:input cssClass="TB" name="fName" path="fName"/>
                    </div>
                    <div class="input-col">
                        <label>Last Name: </label>
                        <form:input class="TB" name="lName" path="lName"/>
                    </div>
                </div>
                <div class="form-row">
                    <h4>Job Information</h4>
                    <div class="input-col">
                        <label>Job Title: </label>
                        <c:choose>
							<c:when test="${userDetails.isOwner == true}">
							<span>Company Owner</span>
							</c:when>
						<c:otherwise>
						<select class="TB" id="jobTitle" name="jobTitle" >
						<option>-- None --</option>
						<c:forEach var="jobTitle" items="${jobTitles}">
							<c:choose >
								<c:when test="${jobTitle.id == userDetails.jobTitle.id }">
									<option value="${jobTitle.id}" selected="selected">${jobTitle.name}</option>
								</c:when>
								<c:otherwise>
									<option value="${jobTitle.id}">${jobTitle.name}</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
						</select>
						</c:otherwise>
                      </c:choose>
                    </div>
                </div>
                <div class="form-row">
                    <h4>Other Information</h4>
                    <div class="input-col">
                        <label>Nick Name: </label>
                        <form:input class="TB" name="nickName" path="nickName"/>
                    </div>
                    <div class="input-col">
                        <label>About Me: </label>
                        <form:textarea class="TB" path="empInfo" name="empInfo"></form:textarea>
                    </div>
                </div>
                <div class="btns">
                <input type="submit" value="Save" class="form-btn"/><a href="/sales/s/profile" class="form-btn">Cancel</a>
                </div>
                </form:form>
                </div>
            </div>
        </div>
        
	<%@include file="footer.jspf" %>
    </div>
    </div>

    </body>
</html>